package imageManager.service;

import java.io.File;
import java.io.FilenameFilter;

public class OnlyExts implements FilenameFilter {
	protected String[] dotExts;
	
	public OnlyExts(String exts) {
		dotExts = exts.split(";");
		
		for(int i = 0; i < dotExts.length; ++i)
			dotExts[i] = "." + dotExts[i];
	}
	
	@Override
	public boolean accept(File dir, String name) {
		for(int i = 0; i < dotExts.length; ++i) {
			if(name.endsWith(dotExts[i]))
				return true;
		}
		
		return false;
	}

}
